package com.zch.client.spring.mqtt.properties;

import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties(prefix = "mqtt")
public class MqttAutoConfigProperties {
    //mqtt 服务端地址
   private String url;
   private String username;
   private String password;
   //mqtt 客户端唯一标识的id
   private String clientId;
   //启动自动订阅的topic 如果有多个，用逗号隔开
   private String subscribeTopics;
   // #启动自动订阅的topic对应得qos 如果有多个，用逗号隔开
   private String subscribeQos;
   //连接超时时间 框架底层默认是30秒
   private int connectTimeoutSeconds;
   //设置心跳时间 单位为秒，表示服务器每隔 1.5*20秒的时间向客户端发送心跳判断客户端是否在线
   private int keepAliveSeconds;
   // 设置遗嘱消息的话题，若客户端和服务器之间的连接意外断开，服务器将发布客户端的遗嘱信息
   private String willTopic;
    private Autoconfig autoconfig = new Autoconfig();

    public static class Autoconfig {
        private boolean enabled = false; // 默认值为 false

        // Getter 和 Setter
        public boolean isEnabled() {
            return enabled;
        }

        public void setEnabled(boolean enabled) {
            this.enabled = enabled;
        }
    }

    // Getter 和 Setter
    public Autoconfig getAutoconfig() {
        return autoconfig;
    }

    public void setAutoconfig(Autoconfig autoconfig) {
        this.autoconfig = autoconfig;
    }
    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getClientId() {
        return clientId;
    }

    public void setClientId(String clientId) {
        this.clientId = clientId;
    }

    public String getSubscribeTopics() {
        return subscribeTopics;
    }

    public void setSubscribeTopics(String subscribeTopics) {
        this.subscribeTopics = subscribeTopics;
    }

    public String getSubscribeQos() {
        return subscribeQos;
    }

    public void setSubscribeQos(String subscribeQos) {
        this.subscribeQos = subscribeQos;
    }

    public int getConnectTimeoutSeconds() {
        return connectTimeoutSeconds;
    }

    public void setConnectTimeoutSeconds(int connectTimeoutSeconds) {
        this.connectTimeoutSeconds = connectTimeoutSeconds;
    }


    public int getKeepAliveSeconds() {
        return keepAliveSeconds;
    }

    public void setKeepAliveSeconds(int keepAliveSeconds) {
        this.keepAliveSeconds = keepAliveSeconds;
    }

    public String getWillTopic() {
        return willTopic;
    }

    public void setWillTopic(String willTopic) {
        this.willTopic = willTopic;
    }
}
